improve travis docker script. (#199)
authortsteven4 <tsteven4@users.noreply.github.com>
Mon, 18 Jun 2018 18:33:57 +0000 (12:33 -0600)
committerGitHub <noreply@github.com>
Mon, 18 Jun 2018 18:33:57 +0000 (12:33 -0600)
tools/travis_script_linux_docker

index 22ec02a8c30a7c1d5b70db5fdd61153d91bc6060..5ce300575e4425a4a9cef07cc98b377ad1f9c884 100755 (executable)
@@ -3,11 +3,18 @@
 # setup up and run a docker build.
 # this is used by travis.
 #
-# create the container to run the build and regression.
+# run the build and regression in a newly created container.
 # pass the compiler from the travis matrix through CC, CXX.
 # we need the default charmap to be UTF-8 for test_encoding_utf8, explicit set it here through LC_ALL.
-cnt=$(docker create  -v `pwd`:/app -e CC=$CC -e CXX=$CXX -e LC_ALL=C.UTF-8 tsteven4/gpsbabel_build_environment bash -c "./build_and_test")
-# copy the pwd to the container.  travis has got the code user test in the pwd.
-docker cp . $cnt:/app
-# run the container to execute the build and the regression.
-docker start -a $cnt
+# travis has got the code to test in the pwd.
+docker run \
+--rm \
+--mount type=bind,source="$(pwd)",target=/app \
+--env CC=$CC \
+--env CXX=$CXX \
+--env LC_ALL=C.UTF-8 \
+--mount type=bind,source=/etc/passwd,target=/etc/passwd,readonly \
+--mount type=bind,source=/etc/group,target=/etc/group,readonly \
+--user "$(id -u):$(id -g)" \
+tsteven4/gpsbabel_build_environment \
+bash -c "./build_and_test"